package Drink.Servlect;

import Drink.service.DrinkServiceImpl;
import Snacks.entiy.Snacks;
import Snacks.sevise.SnacksServise;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/DrinkServletDelete")
public class DrinkServletDelete extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String snacksldStr=request.getParameter("snacksld");
        int snacksld=snacksldStr!=null?Integer.parseInt(snacksldStr):0;

        SnacksServise service=new DrinkServiceImpl();

        Snacks snacks=new Snacks();
        snacks.setSnacksld(snacksld);
        int count=service.deletInfor(snacks);

        PrintWriter out=response.getWriter();
        out.print(count);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
